﻿@using Fyp.Models;

@{
    ViewBag.Title = "MeetingMinutes";
}

@{
    Layout = "~/Shared/_layoutPage.cshtml";
    var PageTitle = "Meeting Minutes";

    MeetingMinute minute = new MeetingMinute();
    
    var MeetingTitle = ViewData["mtitle"];
    var MeetingDate = ViewData["mdate"];
    var MeetingTime = ViewData["mtime"];
    var MeetingLoc = ViewData["mlocation"];
    var MeetingCalledBy = ViewData["mcalledby"];
    var Attendees = ViewData["attendees"];
    var MeetingType = ViewData["mtype"];
    var TimeAlloted = ViewData["mtimealloted"];
    var AgendaTopics = ViewData["magenda"];
    var Presenter = ViewData["mpresenter"];
    var Discussion = ViewData["mdiscussion"];
    var Comments = ViewData["mcomment"];
    var Gid = ViewData["mgid"];

    var MeetingTitle2 = minute.MMTitle;
    var MeetingDate2 = "";
    var MeetingTime2 = minute.MMTime;
    var MeetingLoc2 = minute.MMLocation;
    var MeetingCalledBy2 = minute.MCalledBy;
    var Attendees2 = minute.Attendees;
    var MeetingType2 = minute.MMType;
    var TimeAlloted2 = minute.TimeAlloted;
    var AgendaTopics2 = minute.AgendaTopic;
    var Presenter2 = minute.Presenter;
    var Discussion2 = minute.DiscussionText;
    var Comments2 = minute.CommentText;
    var Gid2 = minute.GId;
    
    var mmId = 0;

    var meeting = (List<MeetingMinute>)ViewData["minutes"];

    if (meeting != null)
    {
        foreach (var data in meeting)
        {
            MeetingTitle2 = data.MMTitle;
            MeetingDate2 = data.MMDate.Value.ToString("dd/MM/yyyy");
            MeetingTime2 = data.MMTime;
            MeetingLoc2 = data.MMLocation;
            MeetingCalledBy2 = data.MCalledBy;
            MeetingType2 = data.MMType;
            Attendees2 = data.Attendees;
            TimeAlloted2 = data.TimeAlloted;
            AgendaTopics2 = data.AgendaTopic;
            Presenter2 = data.Presenter;
            Discussion2 = data.DiscussionText;
            Comments2 = data.CommentText;
            Gid2 = data.GId;
            mmId = Convert.ToInt32(data.MeetingMinuteId);
        }
        foreach (var item in meeting)
        {
            minute = item;
        }
    }
   
    var meetingdate = "";
    if (minute.MMDate!=null)
    {
        meetingdate = ((DateTime)minute.MMDate).ToString("dd/MM/yyyy");
    }
}

@section title
{
    @PageTitle
}
    
<script src="/Scripts/jquery-1.8.2.js" type="text/javascript"></script>
<link rel="stylesheet" href="form.css" />
<script src="/Scripts/jquery-ui.js" type="text/javascript"></script>
<link rel="stylesheet" href="/Styles/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="~/Styles/template.css" media="screen">
<link href="../../Styles/jquery.ambiance.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery.ambiance.js" type="text/javascript"></script>
<link rel="stylesheet" href="/Styles/jquery.timeentry.css" />
<script type="text/javascript" src="/Scripts/jquery.timeentry.js"></script>

<script type="text/javascript">

    function Save() {
        $.ambiance({
            message: "Your work is saved successfully!",
            title: "Success!",
            type: "success"
        });

        }

        /* $(document).ready(function () {

             $("#mdate").datepicker({
            changeMonth: true,
            changeYear: true,

            beforeShow: function (input, inst)
            { inst.dpDiv = $('<div style="display: none;"></div>'); }

        });


        $("#mdate1").datepicker({
            changeMonth: true,
            changeYear: true,
        });

        $("#mtime").timeEntry({

            mtime:readonly(),
            show24Hours: false, showSeconds: false, ampmNames: ['AM', 'PM'],
            
        });

        $("#mtime1").timeEntry({
            show24Hours: false, showSeconds: false, ampmNames: ['AM', 'PM'],
        });
       });*/
   
</script>
  
     <br/> <div id="content">
               <h2 style="text-align: center; margin-bottom: -45px;margin-left: 37px;width: 538px;"><b>Meeting Minutes</b></h2><br/>
            </div>
         
<form action="/MeetingMinute/MeetingMinute" class="background" method="post" style="margin-top: -18px;"> 
    <table style="margin-left: 52px;">
      <tbody>
           
        <tr>
             <input type="text" name= "ID" class ="clear" style="display:none" value = "@mmId" />
             <td><label>Meeting Title</label></td>
          @if (WebSecurity.IsAuthenticated && Roles.IsUserInRole("Advisor"))
          {
              
              
              if (minute.MeetingMinuteId == null || minute.MeetingMinuteId == 0)
              {
                  <td>
                     <input type ="text" name ="mTitle" placeholder = "Meeting Title" value="@MeetingTitle" required/> <br/>
                  </td>
              }
              else
              {
                  <td>
                     <input type ="text" name ="mTitle" placeholder = "Meeting Title" value="@MeetingTitle2" required /> <br/>
                  </td>
              }
          }
          else
          {
               <td>
                    <label >@minute.MMTitle</label>
               </td>
          }
  
        </tr>
        

        <tr>
             <td style="font-family: Tahoma;">MINUTES</td>
         @if (WebSecurity.IsAuthenticated && Roles.IsUserInRole("Advisor"))
         {
            
             
             if (minute.MeetingMinuteId == null || minute.MeetingMinuteId == 0)
             {
                <td><input type = "date"  name="mdate1"   value="@MeetingDate" required/></td>
                <td><input type = "time"  name="mtime1"  value ="@MeetingTime" required/></td>
                <td><input type = "text" placeholder = "Meeting Location" name="mlocation" value ="@MeetingLoc" required/></td>
             }
             else
             {
                <td><input type = "date"  name="mdate1"   value="@meetingdate" required/></td>
                <td><input type = "time"  name="mtime1"  value ="@MeetingTime2" required/></td>
                <td><input type = "text" placeholder = "Meeting Location" name="mlocation" value ="@MeetingLoc2" required/></td>
             }
         }
         else
         {   
            <td><label> @meetingdate</label></td> 
            <td><label> @minute.MMTime</label></td> 
            <td><label >@minute.MMLocation</label></td> 
         }
         </tr>
          
        </tbody>
</table>
    
    <table border = "1" style="margin-left: 52px;" >
        <tbody>
        
        <tr>
            <td style="font-family: Tahoma;font-size: 13px;"> FYP Group ID</td>
         @if (WebSecurity.IsAuthenticated && Roles.IsUserInRole("Advisor"))
         {
             
             
             if (minute.MeetingMinuteId == null || minute.MeetingMinuteId == 0)
             {
                <td><input type = "text" size ="79" name="Gid"value="@Gid" required /></td>
             }
             else
             {
                 <td><input type = "text" size ="79" name="Gid"value="@Gid2" required /></td>
             }

         }
         else
         {
           <td style="font-family: Tahoma;font-size: 13px;"><label>@minute.GId</label></td>         
         }
        </tr>

        <tr>
            <td style="font-family: Tahoma;font-size: 13px;"> MEETING CALLED BY</td>
       
         @if (WebSecurity.IsAuthenticated && Roles.IsUserInRole("Advisor"))
         {
             
             
             if (minute.MeetingMinuteId == null || minute.MeetingMinuteId == 0)
             {
                <td><input type = "text" size ="79" name="mCalledBy"value="@MeetingCalledBy" required /></td>
             }
             else
             {
                 <td><input type = "text" size ="79" name="mCalledBy"value="@MeetingCalledBy2" required/></td>
             }

         }
         else
         {
           <td style="font-family: Tahoma;font-size: 13px; width:325px"><label> @minute.MCalledBy</label></td> 
         }
        </tr>

        <tr>
              <td style="font-family: Tahoma;font-size: 13px;"> TYPE OF MEETING </td>
         @if (WebSecurity.IsAuthenticated && Roles.IsUserInRole("Advisor"))
         {
           
             
             if (minute.MeetingMinuteId == null || minute.MeetingMinuteId == 0)
             {
                <td>
                    <input type = "text" size ="79" name="mType" value="@MeetingType" required/>
                </td>
             }
             else
             {
                 <td>
                    <input type = "text" size ="79" name="mType" value="@MeetingType2" required/>
                </td>
             }
         }
         else
         {
            <td style="font-family: Tahoma;font-size: 13px;"><label>  @minute.MMType</label></td> 
         }
        </tr>

        <tr>
             <td style="font-family: Tahoma;font-size: 13px;"> ATTENDEES </td>
        @if (WebSecurity.IsAuthenticated && Roles.IsUserInRole("Advisor"))
        {
           
            
            if (minute.MeetingMinuteId == null || minute.MeetingMinuteId == 0)
            {
                <td>
                    <input type = "text" size ="79" name="mAttendees" value="@Attendees" required/>
                </td>
            }
            else
            {
                <td>
                    <input type = "text" size ="79" name="mAttendees" value="@Attendees2" required/>
                </td>
            }
        }
        else
        {
            <td  style="font-family: Tahoma;font-size: 13px;"><label>@minute.Attendees</label></td>    
        }
        </tr>
        </tbody>
</table>
    
     <table style="margin-left: 52px;">
        <tbody>
             <tr>
                    <td style= "font-family: Tahoma;font-size: 15px;"><label> Agenda topics</label></td>
                </tr>
             <tr>  
         @if (WebSecurity.IsAuthenticated && Roles.IsUserInRole("Advisor"))
         {
             
             if (minute.MeetingMinuteId == null || minute.MeetingMinuteId == 0)
             {
                  
                        <td><input type = "text" placeholder = "TIME ALLOTTED" name="timeAlloted" value="@TimeAlloted" required/></td>
                        <td><input type = "text" placeholder = "AGENDA TOPIC" name="agendaTopics" value="@AgendaTopics" required/></td>
                        <td><input type = "text" placeholder = "PRESENTER" name="presenter" value="@Presenter" required/></td>
                   
             }
             else
             {
                 
                        <td><input type = "text" placeholder = "TIME ALLOTTED" name="timeAlloted" value="@TimeAlloted2" required/></td>
                        <td><input type = "text" placeholder = "AGENDA TOPIC" name="agendaTopics" value="@AgendaTopics2" required/></td>
                        <td><input type = "text" placeholder = "PRESENTER" name="presenter" value="@Presenter2" required/></td>  
             }

         }
         else
         {
                
                   <td><label >@minute.TimeAlloted</label></td> 
                   <td><label >@minute.AgendaTopic</label></td> 
                   <td><label >@minute.Presenter</label></td> 
                
         
         }
        </tr>          
        </tbody>
</table>
    
    <table border = "1" style="margin-left: 52px;">
        <tbody>
        <tr>
              <td style = "font-family: Tahoma;font-size: 16px;">Discussion</td>
         @if (WebSecurity.IsAuthenticated && Roles.IsUserInRole("Advisor"))
         {
            
             
             if (minute.MeetingMinuteId == null || minute.MeetingMinuteId == 0)
             {
                 <td>
                   <input type = "text" name="discussion" value="@Discussion" size = "87" style="padding-bottom: 13px;" required/>
                 </td>
             }
             else
             {
                  <td>
                   <input type = "text" name="discussion" value="@Discussion2" size = "87" style="padding-bottom: 13px;" required/>
                 </td>
             }
         }
         else
         {
           <td style="width:325px"><label >@minute.DiscussionText</label></td>  
         }
        </tr>
         
        </tbody>
</table>
    
    <table style="margin-left: 52px;">
        <tbody>
          <tr><td></td></tr>
        <tr>
            <td style = "font-family: Tahoma;font-size: 15px;">Comments: </td>
            @if (WebSecurity.IsAuthenticated && Roles.IsUserInRole("Advisor"))
            {
                 
                
                if (minute.MeetingMinuteId == null || minute.MeetingMinuteId == 0)
                {
                     <td>
                        <textarea rows ="7" cols ="50" name ="comments" required>@Comments</textarea>
                     </td>
                }
                else
                {
                     <td>
                        <textarea rows ="7" cols ="50" name ="comments" required>@Comments2</textarea>
                     </td>
                }
            }
            else
            {
               <td>
                <td><label >@minute.CommentText</label></td> 
              </td> 
            }
        </tr>
  </tbody>
</table>
    
    @if (WebSecurity.IsAuthenticated && Roles.IsUserInRole("Advisor"))
    {
         <div>
            <br/><input type="submit" value="Save" style ="display:block;margin-left: 570px;margin-top: -61px;" class = "buttonSave" onclick="Save()" />
                  <input type="submit" value="Cancel" style ="display:block;margin-left: 648px;margin-top: -36px;padding:10px;" class = "buttonCancel" />
         </div>
    }
    else
    {
         <div>
            <br/><input type="submit" value="Save" style ="display:none;margin-left: 570px;margin-top: -61px;" class = "buttonSave" onclick="Save()" />
                  <input type="submit" value="Cancel" style ="display:none;margin-left: 648px;margin-top: -36px;padding:10px;" class = "buttonCancel" />
         </div>
    }   
</form>

 